package com.bw.client;

import com.bw.domain.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Component
@FeignClient(value = "user-server")
public interface UserClient {

    @RequestMapping("selectUserByToken")
     User selectUserByToken(@RequestParam(value = "token",required = false) String token);


}
//@Component
class UserClientBack implements UserClient{


    @Override
    public User selectUserByToken(String token) {

        System.out.println("服务降级了-------");
        //如果接口访问失败默认认证权限通过
        // 构造一个假用户
        return User.builder().id(1).role(3).build();
    }
}
